package com.rongshu.view.penpal.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.rongshu.view.penpal.fragment.Penpal_DiscoveryFragment;
import com.rongshu.view.penpal.fragment.Penpal_JoinedFragment;
import com.rongshu.view.penpal.fragment.Penpal_NearbyFragment;

/**
 * created by zhengweis on 2018/11/1.
 * description：
 */
public class MorePenpalPageAdapter extends FragmentStatePagerAdapter {
    String[] titles = {"我的", "推荐", "附近"};

    public MorePenpalPageAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        return createForNoExpand(position);
    }

    @Override
    public int getCount() {
        return titles.length;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }

    private Fragment createForNoExpand(int position) {
        Fragment fragment = null;
        switch (position) {
            case 0:
                fragment = new Penpal_JoinedFragment();
                break;
            case 1:
                fragment = new Penpal_DiscoveryFragment();
                break;
            case 2:
                fragment = new Penpal_NearbyFragment();
                break;
        }
        return fragment;
    }
}